home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / Hyper / M-Md / MacUser.cpt / MacUser MiniFinders / card_25403.txt < prev    next >
Text File  |  1990-07-05  |  13KB  |  528 lines

  1. -- card: 25403 from stack: in
  2. -- bmap block id: 33388
  3. -- flags: 4000
  4. -- background id: 28315
  5. -- name: UpdateCard
  6.  
  7.  
  8. -- part 1 (field)
  9. -- low flags: 01
  10. -- high flags: 0000
  11. -- rect: left=92 top=53 right=302 bottom=467
  12. -- title width / last selected line: 0
  13. -- icon id / first selected line: 0 / 0
  14. -- text alignment: 0
  15. -- font id: 136
  16. -- text size: 10
  17. -- style flags: 0
  18. -- line height: 13
  19. -- part name: aboutUpdate
  20.  
  21.  
  22. -- part 11 (button)
  23. -- low flags: 80
  24. -- high flags: 0004
  25. -- rect: left=189 top=131 right=214 bottom=366
  26. -- title width / last selected line: 0
  27. -- icon id / first selected line: 0 / 0
  28. -- text alignment: 1
  29. -- font id: 0
  30. -- text size: 12
  31. -- style flags: 0
  32. -- line height: 16
  33. -- part name: progressPad
  34.  
  35.  
  36. -- part 15 (field)
  37. -- low flags: 80
  38. -- high flags: 0000
  39. -- rect: left=190 top=186 right=212 bottom=363
  40. -- title width / last selected line: 0
  41. -- icon id / first selected line: 0 / 0
  42. -- text alignment: 1
  43. -- font id: 3
  44. -- text size: 9
  45. -- style flags: 0
  46. -- line height: 12
  47. -- part name: WhatamiDoing
  48.  
  49.  
  50. -- part 13 (field)
  51. -- low flags: 80
  52. -- high flags: 0000
  53. -- rect: left=191 top=133 right=176 bottom=357
  54. -- title width / last selected line: 0
  55. -- icon id / first selected line: 0 / 0
  56. -- text alignment: 0
  57. -- font id: 3
  58. -- text size: 9
  59. -- style flags: 0
  60. -- line height: 14
  61. -- part name: progressField
  62.  
  63.  
  64. -- part 14 (button)
  65. -- low flags: 80
  66. -- high flags: 0002
  67. -- rect: left=201 top=149 right=161 bottom=349
  68. -- title width / last selected line: 0
  69. -- icon id / first selected line: 0 / 0
  70. -- text alignment: 1
  71. -- font id: 0
  72. -- text size: 12
  73. -- style flags: 0
  74. -- line height: 16
  75. -- part name: bar
  76.  
  77.  
  78. -- part 16 (button)
  79. -- low flags: 00
  80. -- high flags: 2001
  81. -- rect: left=16 top=45 right=75 bottom=46
  82. -- title width / last selected line: 0
  83. -- icon id / first selected line: 314 / 314
  84. -- text alignment: 1
  85. -- font id: 0
  86. -- text size: 12
  87. -- style flags: 0
  88. -- line height: 16
  89. -- part name: PopUp
  90. ----- HyperTalk script -----
  91. on mousedown
  92.   doPopUpTOCMenu
  93. end mousedown
  94.  
  95.  
  96.  
  97.  
  98.  
  99. -- part 17 (button)
  100. -- low flags: 00
  101. -- high flags: 2001
  102. -- rect: left=16 top=87 right=117 bottom=46
  103. -- title width / last selected line: 0
  104. -- icon id / first selected line: 1129 / 1129
  105. -- text alignment: 1
  106. -- font id: 0
  107. -- text size: 12
  108. -- style flags: 0
  109. -- line height: 16
  110. -- part name: Next
  111. ----- HyperTalk script -----
  112. on mouseUp
  113.   visual scroll left
  114.   go next cd
  115. end mouseUp
  116.  
  117.  
  118.  
  119. -- part 18 (button)
  120. -- low flags: 00
  121. -- high flags: 2001
  122. -- rect: left=16 top=129 right=159 bottom=46
  123. -- title width / last selected line: 0
  124. -- icon id / first selected line: 1130 / 1130
  125. -- text alignment: 1
  126. -- font id: 0
  127. -- text size: 12
  128. -- style flags: 0
  129. -- line height: 16
  130. -- part name: Previous
  131. ----- HyperTalk script -----
  132. on mouseUp
  133.   visual scroll right
  134.   go prev cd
  135. end mouseUp
  136.  
  137.  
  138.  
  139. -- part 19 (button)
  140. -- low flags: 00
  141. -- high flags: 2001
  142. -- rect: left=16 top=171 right=201 bottom=46
  143. -- title width / last selected line: 0
  144. -- icon id / first selected line: 1131 / 1131
  145. -- text alignment: 1
  146. -- font id: 0
  147. -- text size: 12
  148. -- style flags: 0
  149. -- line height: 16
  150. -- part name: Back
  151. ----- HyperTalk script -----
  152. on mouseUp
  153.   visual effect zoom close
  154.   go to card "Contents"
  155. end mouseUp
  156.  
  157.  
  158.  
  159. -- part 20 (button)
  160. -- low flags: 00
  161. -- high flags: 2001
  162. -- rect: left=16 top=213 right=243 bottom=46
  163. -- title width / last selected line: 0
  164. -- icon id / first selected line: 1895 / 1895
  165. -- text alignment: 1
  166. -- font id: 0
  167. -- text size: 12
  168. -- style flags: 0
  169. -- line height: 16
  170. -- part name: Help
  171. ----- HyperTalk script -----
  172. on mouseUp
  173.   visual effect zoom open
  174.   push card
  175.   go to card "Help card"
  176. end mouseUp
  177.  
  178.  
  179.  
  180. -- part 21 (button)
  181. -- low flags: 00
  182. -- high flags: 2001
  183. -- rect: left=16 top=255 right=285 bottom=46
  184. -- title width / last selected line: 0
  185. -- icon id / first selected line: 7449 / 7449
  186. -- text alignment: 1
  187. -- font id: 0
  188. -- text size: 12
  189. -- style flags: 0
  190. -- line height: 16
  191. -- part name: Find
  192. ----- HyperTalk script -----
  193. on mouseUp
  194.   visual effect zoom open
  195.   go card findCard
  196. end mouseUp
  197.  
  198.  
  199.  
  200. -- part 22 (button)
  201. -- low flags: 00
  202. -- high flags: 2001
  203. -- rect: left=16 top=297 right=327 bottom=46
  204. -- title width / last selected line: 0
  205. -- icon id / first selected line: 27267 / 27267
  206. -- text alignment: 1
  207. -- font id: 0
  208. -- text size: 12
  209. -- style flags: 0
  210. -- line height: 16
  211. -- part name: Quit
  212. ----- HyperTalk script -----
  213. on mouseUp
  214.   answer "Do you want to Quit or go Home?" with "Quit" or "Home" or "Cancel"
  215.   if it is "Cancel" then exit mouseUp
  216.   if it is "Quit" then
  217.     DoMenu "Quit Hypercard"
  218.   else go home
  219. end mouseUp
  220.  
  221.  
  222.  
  223. -- part 23 (field)
  224. -- low flags: 01
  225. -- high flags: 0000
  226. -- rect: left=99 top=8 right=39 bottom=206
  227. -- title width / last selected line: 0
  228. -- icon id / first selected line: 0 / 0
  229. -- text alignment: 0
  230. -- font id: 132
  231. -- text size: 24
  232. -- style flags: 0
  233. -- line height: 32
  234. -- part name: subject 2
  235.  
  236.  
  237. -- part 24 (field)
  238. -- low flags: 01
  239. -- high flags: 0000
  240. -- rect: left=248 top=5 right=22 bottom=512
  241. -- title width / last selected line: 0
  242. -- icon id / first selected line: 0 / 0
  243. -- text alignment: 0
  244. -- font id: 136
  245. -- text size: 12
  246. -- style flags: 0
  247. -- line height: 16
  248. -- part name: Instructions
  249.  
  250.  
  251. -- part 26 (button)
  252. -- low flags: 00
  253. -- high flags: A003
  254. -- rect: left=333 top=307 right=332 bottom=495
  255. -- title width / last selected line: 0
  256. -- icon id / first selected line: 0 / 0
  257. -- text alignment: 0
  258. -- font id: 132
  259. -- text size: 18
  260. -- style flags: 0
  261. -- line height: 24
  262. -- part name:     Update this Stack
  263. ----- HyperTalk script -----
  264. on mouseUp
  265.   import
  266. end mouseUp
  267.  
  268. -- List of handlers:
  269.  
  270. -- on import
  271. -- on deleteOldCards
  272. -- on clearFields
  273. -- on importText fileName,checkForDupes
  274. -- on doMiniFinderSort
  275. -- function miniFinderOrder()
  276.  
  277.  
  278. -- handler for importing new data into MiniFinders Stack:
  279.  
  280. on import
  281.   GLOBAL howManyRecords
  282.   put the userlevel into priorUserlevel
  283.   set the userlevel to 5
  284.   answer "Import new Data?" with "OK" or "Cancel"
  285.   if it is "Cancel" then exit import
  286.   answer "Append data or replace?" with "Append" or "Replace" or "Cancel"
  287.   if it is "Cancel" then exit import
  288.   startProgress
  289.  
  290.   if it is "Replace" then
  291.     if permission ("trash all old data") is "Cancel" then
  292.       progressOver
  293.       exit import
  294.     end if
  295.     put "Now deleting all your old cards..." into cd fld WhatamIDoing
  296.     show cd fld WhatamIDoing
  297.     lock screen
  298.     deleteOldCards
  299.   end if
  300.   go card updateCard
  301.   unlock screen
  302.   put fileName()into fileName
  303.   if fileName is empty then
  304.     answer "Import Canceled!"
  305.     hide cd fld WhatamIDoing
  306.     progressOver
  307.     exit import
  308.   end if
  309.   if the visible of cd fld WhatamIDoing is false then show cd fld WhatamIDoing
  310.   put "Now importing text data..." into cd fld WhatamIDoing
  311.   refresh
  312.   lock screen
  313.   importText fileName,it    -- it now contains "Append" or "Replace"
  314.   go card updateCard
  315.   unlock screen
  316.   put "Now Sorting cards..." into cd fld WhatamIDoing
  317.   lock screen
  318.   doMiniFinderSort
  319.   go card updateCard
  320.   unlock screen
  321.   put "Now Compacting Stack." into cd fld WhatamIDoing
  322.   doMenu "Compact Stack"
  323.   lock screen
  324.   progressOver
  325.   hide cd fld WhatamIDoing
  326.   unlock screen
  327.   answer ("Done. Imported" && howManyRecords && "entries") with "Finally"
  328.   set userlevel to priorUserlevel
  329. end import
  330.  
  331.  
  332. -- deletes all old cards
  333. on deleteOldCards
  334.   put the number of cards in bg data into total
  335.   put true into alltheWay
  336.   put progressRect() into pRect
  337.   go card 1 of bg data
  338.   clearFields
  339.   put true into alltheWay
  340.   go next card
  341.   repeat with i = 2 to total
  342.     doMenu "Delete Card"
  343.     go cd 2 of bg data
  344.     colorRectProgress pRect,i,total,blue
  345.     if the mouseClick then
  346.       if abortSearch() is true then
  347.         put false into alltheWay
  348.         go card updateCard
  349.         progressOver
  350.         hide card fld WhatAmIDoing
  351.         exit to HyperCard
  352.       end if
  353.     end if
  354.   end repeat
  355.   if alltheWay is true then
  356.     colorRectProgress pRect,total,total,blue
  357.   end if
  358. end deleteOldCards
  359.  
  360.  
  361. -- clears out data in all flds on a card
  362.  
  363. on clearFields
  364.   repeat with i = 1 to the number of flds
  365.     put empty into fld i
  366.   end repeat
  367. end clearFields
  368.  
  369.  
  370. -- Where text gets imported. Also checks for duplicate products, so
  371. -- their review text or ratings may be changed.
  372.  
  373. on importText fileName,checkForDupes
  374.   GLOBAL howManyRecords
  375.   put true into alltheWay
  376.   put 600 into total -- expecting around 600 to import
  377.   put progressRect() into pRect
  378.   go to last card of bg data
  379.   open file fileName
  380.   put 1 into counter
  381.  
  382.   -- here is the core of the whole import process:
  383.   repeat
  384.     set cursor to busy
  385.     add 1 to counter
  386.     colorRectProgress pRect,counter,total,blue
  387.     read from file fileName until tab
  388.     if it is empty then exit repeat
  389.     delete last char of it
  390.     put it into SubjectHolder
  391.     read from file fileName until tab
  392.     delete last char of it
  393.     if checkForDupes is "Append" then
  394.       do ("find whole" && quote & it & quote && "in fld Product")
  395.       if the result is "not found" then
  396.         go last cd of bg data
  397.         doMenu "New Card"
  398.       end if
  399.     end if
  400.     put SubjectHolder into fld "Subject"
  401.     put it into fld "Product"
  402.     read from file fileName until tab
  403.     delete last char of it
  404.     put word 1 of it into fld "numericMice"
  405.     put mouseEquivalent(word 1 of it) into fld "Mice"
  406.     read from file fileName until tab
  407.     delete last char of it
  408.     put it into fld "Descript"
  409.     read from file fileName until tab
  410.     delete last char of it
  411.     put it into fld "Company Name"
  412.     read from file fileName until tab
  413.     delete last char of it
  414.     put it into fld  "St Address"
  415.     read from file fileName until tab
  416.     delete last char of it
  417.     put it into fld  "City"
  418.     read from file fileName until tab
  419.     delete last char of it
  420.     put it into fld  "Phone"
  421.     read from file fileName until tab
  422.     delete last char of it
  423.     put it into fld  "Date Reviewed"
  424.     read from file fileName until tab
  425.     delete last char of it
  426.     put it into fld "Version Shipping"
  427.     read from file fileName until tab
  428.     delete last char of it
  429.     put it into fld "Price"
  430.     read from file fileName until return
  431.     delete last char of it
  432.     put it into fld "Eddy"
  433.     if the mouseClick then   -- check for mouse click to abort ...
  434.       if abortSearch() is true then
  435.         put false into alltheWay
  436.         go cd findCard
  437.         exit repeat
  438.       end if
  439.     end if
  440.     if checkForDupes is "Replace" then doMenu "New Card"
  441.   end repeat
  442.   if alltheWay is true then
  443.     colorRectProgress pRect,total,total,blue
  444.   end if
  445.   close file fileName
  446.   -- clear out any empty cards at the end of the stack...
  447.   go to last card of bg data
  448.   repeat
  449.     if fld subject = "" then doMenu "Delete Card"
  450.     go last card of bg data
  451.     if fld subject ‚↠empty then exit repeat
  452.   end repeat
  453.   put counter into howManyRecords
  454. end importText
  455.  
  456. on doMiniFinderSort
  457.   sort by miniFinderOrder()
  458. end doMiniFinderSort
  459.  
  460.  
  461. -- This function orders the cards so that all 'shell' cards
  462. -- (Table of Contents, Find, Help, etc.) are not reordered, but
  463. -- the new cards created or appended are sorted alphabetically by
  464. -- subject and alphabetically by product within each subject.
  465.  
  466. function miniFinderOrder
  467. if  short name of this bg = "Shell" then
  468.   return "AAAAAAAA"
  469. end if
  470. if fld "Subject" = "" then return "ZZZZZZZZ"
  471. return fld "Subject" && fld "Product"
  472. end miniFinderOrder
  473.  
  474.  
  475.  
  476.  
  477. -- part 27 (button)
  478. -- low flags: 00
  479. -- high flags: A003
  480. -- rect: left=181 top=307 right=332 bottom=326
  481. -- title width / last selected line: 0
  482. -- icon id / first selected line: 0 / 0
  483. -- text alignment: 0
  484. -- font id: 132
  485. -- text size: 18
  486. -- style flags: 0
  487. -- line height: 24
  488. -- part name:         About Zmac
  489. ----- HyperTalk script -----
  490. on mouseUp
  491.   visual effect dissolve
  492.   go to card id 49233
  493. end mouseUp
  494.  
  495.  
  496.  
  497. -- part contents for card part 1
  498. ----- text -----
  499. Read this first to update the MiniFinders:
  500.  
  501. 1)   Download the stuffed text file from Zmac, and ‚Äòunstuff‚Äô it using the utilities StuffIt or UnStuffIt. which are also available for download on Zmac. For more information on Zmac, read the About MacUser section available from the Title card of this stack.
  502.  
  503. 2)    For convenience, place the unstuffed file in the same folder as this stack.
  504.  
  505. 3)   Open this stack. Go to this card. Click on the button below called 
  506. ‚ÄòUpdate this Stack...‚Äô. You now must choose between replacing all your current information, or appending and updating your listings.  A text file from Zmac named  ‚ÄòComplete MiniFinders‚Äô will allow you to Replace your current information.  A text file from Zmac called  ‚ÄòMiniFinder Update‚Äô will require you to Append new information.  If you have any doubt about which to do, click on Cancel, or try ‚ÄòUpdate‚Äô first with a copy of this stack.
  507.  
  508. 4)  You will see a dialog for the file to import. Choose your text file. The stack will do the rest.
  509.  
  510.  
  511.  
  512. -- part contents for card part 13
  513. ----- text -----
  514. Progress:
  515.  
  516. Click the mouse to halt import.
  517.  
  518. -- part contents for card part 15
  519. ----- text -----
  520. Now deleting all your old cards...
  521.  
  522. -- part contents for card part 23
  523. ----- text -----
  524. PDATE
  525.  
  526. -- part contents for card part 24
  527. ----- text -----
  528. Update this stack with new information